package com.liuym.classes.service.impl;

import com.liuym.classes.repository.mapper.DepartMapper;
import com.liuym.classes.repository.model.bo.DepartBO;
import com.liuym.classes.repository.model.entity.Depart;
import com.liuym.classes.service.DepartService;
import com.liuym.common.exception.DepartException;
import com.vip.vjtools.vjkit.reflect.BeanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Liuym
 * @date 2019/1/23 15:14
 * @describe：
 */
@Service
public class DepartServiceImpl implements DepartService {

    @Autowired
    private DepartMapper departMapper;

    @Override
    public DepartBO findById(int id) throws DepartException {
        Depart depart = departMapper.selectByPrimaryKey(id);
        if (depart != null) {
            DepartBO departBO = BeanMapper.map(depart, DepartBO.class);
            return departBO;
        }
        return null;
    }
}
